{template /common/header}
 	<div class="jason_speed">
		<dl>
			<dt>当前缓存</dt>
			<dd class="number">0</dd>
			<dd>kb/s</dd>
		</dl>
	</div>
	<!-- Swiper --> 
    <div class="swiper-container jason_swiper_ykj">
        <div class="swiper-wrapper">
        	{loop $miner $vo}
            <div class="swiper-slide">
	            <ul class="jason_ykj_details">
	            	<li class="ykj_img"><img src="{THEME_PATH}images/ykj{$vo[id]}.png" alt="" width="100"></li>
	            	<li class="ykj_name">{$vo[name]}</li>
	            	<li class="ykj_speed">DBT开采率：{$vo[rate]}</li>
	            	<li>24小时产量：{$vo[profit24min]}~{$vo[profit24max]}</li> 
	            	<li>电池周期：{$vo[runday]}天</li>
	            	<li class="ykj_price">价格：<?php if($vo['id']>0){ echo $vo['money'].'<font size="-2">DBT</font>';}else{echo "赠送";}?></li>
	            	<li><button type="button" class="ykj_buy" id="btnid_<?php echo $vo['id']?>" data-name="{$vo[name]}" 
	            		<?php if($vo['id']>0){?>
	            		onclick="dbtBuy(<?php echo $vo['id']?>,<?php echo $vo['money']?>)"
		            	<?php }else{?>
		            		onclick="tishijavascript:hd_alert('此款矿机为非卖品，限量赠送！');"
		            	<?php }?>

	            		>DBT购买</button></li>
	            </ul>
            </div> 
            {/loop}
        </div>
    </div>
    <p class="jason_ykj_warn">您的每kb流量缓存都可通过云矿机传输到云端，并可开采DBT，此举并不消耗实际手机流量。艾特王国团队会将缓存积累并积极用于慈善应用事业，保护资源，从我做起。</p>
    <style type="text/css">
    	.input_psd{ font-size: 30px; letter-spacing:15px; height: 50px!important; line-height: 50px!important; width: 250px!important; border-bottom: 1px solid #ccc!important; }
    </style>
    <!-- S 购买弹窗 -->
	<div class="closepop popup_shade"></div>
	<div class="popup_buy_machine">
		<ul>
			<li><img src="{THEME_PATH}images/kj.png" alt="" class="kj_img"></li>
			<li>是否花费<span class="money">10</span><font size="-2">DBT</font> 购买<span class="miner_name">迷你云矿机</span></li>
			<li>
				<button type="button" class="btn btn1" onclick="closepop()">取消</button>
				<button type="button" class="btn btn2" onclick="affirm()">确定</button>
			</li>
		</ul>
	</div>
	<!-- E 购买弹窗 -->
	<!-- S 支付密码 -->
	<div class="popup_pay_password">
		<ul>
			<li>需支付</li>
			<li class="pay_dbt"><span class="money">10</span><font size="-2">DBT</font></li>
			<li class="txt">请输入支付密码</li>
			<li class="input_box">
				<input type="number"  style='-webkit-text-security:disc'  id="password" class="input_psd"  maxlength="6" oninput="if(value.length>6)value=value.slice(0,6)" max="6"  >
				<!-- <input type="password" class="input_psd">
				<input type="password" class="input_psd">
				<input type="password" class="input_psd">
				<input type="password" class="input_psd">
				<input type="password" class="input_psd"> -->
			</li>
			<li><button type="button" class="affirm"  onclick="dobuy()">确认</button></li>
		</ul>
	</div>
	<input type="hidden" id="order_sn" value="<?php echo build_order_no();?>" >
	<!-- E 支付密码 -->
	<!-- <script src="js/jquery-1.8.3.min.js"></script> -->
	<script src="{THEME_PATH}js/swiper.min.js"></script>
	<script>
		$(function(){
			$("body").addClass("bgRed");
		})
		var swiper = new Swiper('.jason_swiper_ykj', {
	        slidesPerView: 'auto',
	        paginationClickable: true
	    });
	</script>
	<script>
		var mid = 1;
		var money = 0;
		function dbtBuy(id,jiage){
			money = jiage;
			$(".money").html(money);
			$(".miner_name").html($("#btnid_"+id).data("name"));
			// $(".money").each(function(){
			// 	$(this).html(1002);
			// });
			mid = id;
			$(".popup_shade,.popup_buy_machine").show();
		}
		function affirm(){
			console.log("mid:"+mid);
			$(".popup_pay_password").show();
			$(".popup_buy_machine").hide();
		}
		function closepop(){
			$(".closepop,.popup_buy_machine").hide();
		}
		function dobuy(){
			password = $("#password").val();
			order_sn = $("#order_sn").val();
			if(!password.match(/^[0-9]{6}$/)){
				tips("必须为六位数字");
				return false;
			}
			layer.open({type: 2});
			$.ajax({
				type:'post',
				url:'/index.php?m=user&c=order&a=buyminer',
				data:{id:mid,pinpass:password,order_sn:order_sn},
				dataType:'json',
				success:function(ret){
				  layer.closeAll();
				  console.log(ret);
				  if(ret.status==1){
				  		window.location.href='/index.php?m=user&c=order&a=buyok&order_sn='+ret.oid;
				  }else{
				  		hd_alert(ret.info,"/index.php?m=user&c=user&a=usercert");
				  }
				}
			})
			// console.log(password);
		}
        function setNumber(){
            $(".number").html(parseInt(Math.random()*600)+50);
        }
        setNumber();
        setInterval(setNumber,1500);
	</script>
    {template /common/footer}